/**********************************************
 * 	TestVerb.java							  *
 *  Course: CS3343							  *
 *  Version: 2.5    Release 3				  *
 *  Last Modified : 22 MAR 2013			      *
 **********************************************/
package testChecker;

import org.junit.Before;
import junit.framework.TestCase;
import checker.Noun;
import checker.Verb;
import org.junit.Test;

public class TestVerb extends TestCase {


	@Before
	public void setUp() throws Exception {

	}

	//Test initial letter T
	@Test
	public void testVerbA(){
		
		class VerbStub extends Verb{
			public  boolean isOfType(String word){
				//get all the words starting with the letter that is the same as the initial letter of the input word
				//the second argument is the type of words to be retrieved for comparison, in this case, nouns
				//the return value is an array containing all the relevant words
				String[] verbs = {"tap", "train","track", "trace" };
				
				//simply compare each value in the array with the input word
				for(int i = 0; i < verbs.length; i++){
					if(verbs[i].equalsIgnoreCase(word))
						//returning true means this is a noun
						return true;
				}
				return false;
			}
		
		};
		
		VerbStub verbStub = new VerbStub();
		
		boolean result = verbStub.isOfType("track");
		assertEquals(true, result);
		
	}

	//Test initial letter S
	@Test
	public void testVerbB(){
		
		class VerbStub extends Verb{
			public  boolean isOfType(String word){
				//get all the words starting with the letter that is the same as the initial letter of the input word
				//the second argument is the type of words to be retrieved for comparison, in this case, nouns
				//the return value is an array containing all the relevant words
				String[] verbs = {"search", "sit","sign", "simulate" };
				
				//simply compare each value in the array with the input word
				for(int i = 0; i < verbs.length; i++){
					if(verbs[i].equalsIgnoreCase(word))
						//returning true means this is a noun
						return true;
				}
				return false;
			}
		
		};
		
		VerbStub verbStub = new VerbStub();
		
		boolean result = verbStub.isOfType("seat");
		assertEquals(false, result);
		
	}


	//integration test 1 with the FileIO class
	@Test
	public void testIntegrationWithFileIO1(){
		 Verb verb = new Verb();
		boolean result = verb.isOfType("state");
		assertEquals(true, result);
	}

	//integration test 2 with the FileIO class
	@Test
	public void testIntegrationWithFileIO2(){
		Verb verb = new Verb();
		boolean result = verb.isOfType("hello");
		assertEquals(false, result);
	}
	
	//integration test 3 with the FileIO class
	@Test
	public void testIntegrationWithFileIO3(){
		 Verb verb = new Verb();
		boolean result = verb.isOfType("specify");
		assertEquals(true, result);
	}

	//integration test 4 with the FileIO class
	@Test
	public void testIntegrationWithFileIO4(){
		Verb verb = new Verb();
		boolean result = verb.isOfType("quantity");
		assertEquals(false, result);
	}
	
	//integration test 5 with the FileIO class
	@Test
	public void testIntegrationWithFileIO5(){
		 Verb verb = new Verb();
		boolean result = verb.isOfType("test");
		assertEquals(true, result);
	}

	//integration test 6 with the FileIO class
	@Test
	public void testIntegrationWithFileIO6(){
		Verb verb = new Verb();
		boolean result = verb.isOfType("hell");
		assertEquals(false, result);
	}
	
	// test user-defined constructor
	@Test
	public void testUserDefinedConstructor() {
		Verb verb = new Verb("[v]");
		String result = verb.getSign();
		assertEquals("[v]", result);

	}

}
